

VERSION=.0.0.1

CC=gcc
CPP_FLAGS=
C_FLAGS=-c -O2
C_TEST_FLAGS=-O2

OBJECTS=sdk_util.o sdk_solv.o sdk_list.o

INCLUDE=-I. -I../lib/include
MATVEC=-L../lib -lmatvec

### Main targets

sudoku: $(OBJECTS)
	gcc -o sudosolve$(VERSION) $(OBJECTS) -I. -I../matvec/src \
		-lc -lm $(MATVEC) sudoku.c
	gcc -o sdk_test sdk_test.c $(OBJECTS) -lc -lm \
		$(MATVEC) -I. -I../matvec/src 
	gcc -o sdk_list_test sdk_list_test.c $(OBJECTS) \
		-lc -lm $(MATVEC) -I. -I../matvec/src
	cp sudosolve* ../bin
	cp sdk*test ../bin
	cd ../bin && ln -s sudosolve$(VERSION) sudosolve

### Source building targets

.c:
	$(CC) $(C_TEST_FLAGS) $(CPP_FLAGS) $< $(INCLUDE) -o $@

.c.o:
	$(CC) $(C_FLAGS) $(CPP_FLAGS) $< $(INCLUDE)


### Cleaning targets

clean:
	rm -f *.o
	rm -f sudosolve*
	rm -f sdk_test
	rm -f sdk_list_test
